Beginners c programming: C programming for beginners by Search Engines & Abhishek Bhagat

Beginners c programming: C programming for beginners by Search Engines & Abhishek Bhagat

Author:Search Engines & Abhishek Bhagat [Engines, Search]
Language: eng
Format: epub
Published: 2018-07-14T23:00:00+00:00


Time for an Example

Let's write a simple program with a main() function, and a user defined function to multiply two numbers, which will be called from the main() function.

#include<stdio.h>

int multiply(int a, int b); // function declaration

int main()

{

int i, j, result;

printf("Please enter 2 numbers you want to multiply...");

scanf("%d%d", &i, &j);

result = multiply(i, j); // function call

printf("The result of muliplication is: %d", result);

return 0;

}

int multiply(int a, int b)

{

return (a*b); // function defintion, this can be done in one line

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.